<!DOCTYPE html>
<html>
    
    <head>
        <meta charset="utf-8">
        <title>
            阳光成单系统
        </title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="format-detection" content="telephone=no">
        <link rel="stylesheet" href="./css/x-admin.css" media="all">
    </head>
    
    <body>
          <div class="x-body">
            <form class="layui-form" id="form_product_detail" method="post">
            <div class="layui-form-item">
                    <label for="cname" class="layui-form-label">
                        ID
                    </label>
                    <div class="layui-input-inline">
                        <input type="text" id="fenLeiId" name="fenLeiId" required="" lay-verify="required"
                        autocomplete="off"  value="1" disabled="" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label for="productname" class="layui-form-label">
                        <span class="x-red">*</span>产品名称
                    </label>
                    <div class="layui-input-inline">
                        <input type="text" id="name" name="name" required="" lay-verify="required"
                        autocomplete="off" class="layui-input">
                    </div>
                    <div class="layui-form-mid layui-word-aux">
                        <span class="x-red">*</span>请输入产品名称
                    </div>
                </div>
                <div class="layui-form-item">
                    <label for="productimg" class="layui-form-label">
                    	<span class="x-red">*</span>产品图片
                    </label>
                    <div class="layui-input-inline">
                        <input type="file" id="img" name="img" required="" lay-verify="required"
                        autocomplete="off" class="layui-input">
                    </div>
                    <div class="layui-form-mid layui-word-aux">
                        <span class="x-red">*</span>请上传产品图片
                    </div>
                </div>
                <div class="layui-form-item">
                    <label for="productmaterial" class="layui-form-label">
                        <span class="x-red">*</span>材质
                    </label>
                    <div class="layui-input-inline">
                    	<select name="caiZhi" id="caiZhi">
                            <option value="">请选择材质</option>
                            <option value="1">其他</option>
                        </select>
                    </div>
                    <div class="layui-form-mid layui-word-aux">
                        <span class="x-red">*</span>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label for="marketprice" class="layui-form-label">
                        <span class="x-red">*</span>市场价
                    </label>
                    <div class="layui-input-inline">
                        <input type="text" id="shiChangJia" name="shiChangJia" required="" lay-verify="required"
                        autocomplete="off" class="layui-input">
                    </div>
                    <div class="layui-form-mid layui-word-aux">
                        <span class="x-red">*</span>请输入市场价
                    </div>
                </div>
                <div class="layui-form-item">
                    <label for="currentprice" class="layui-form-label">
                        <span class="x-red">*</span>现价
                    </label>
                    <div class="layui-input-inline">
                        <input type="text" id="xianJia" name="xianJia" required="" lay-verify="required"
                        autocomplete="off" class="layui-input">
                    </div>
                    <div class="layui-form-mid layui-word-aux">
                        <span class="x-red">*</span>请输入现价
                    </div>
                </div>
                <div class="layui-form-item">
                    <label for="deliveryaddress" class="layui-form-label">
                        <span class="x-red">*</span>发货地址
                    </label>
                    <div class="layui-input-inline">
                        <input type="text" id="faHuoDiZhi" name="faHuoDiZhi" required="" lay-verify="required"
                        autocomplete="off" class="layui-input">
                    </div>
                    <div class="layui-form-mid layui-word-aux">
                        <span class="x-red">*</span>请输入发货地址
                    </div>
                </div>
                <div class="layui-form-item">
                    <label for="styleks" class="layui-form-label">
                        <span class="x-red">*</span>款式 
                    </label>
                    <div class="layui-input-inline">
                      <select name="kuanShi" id="kuanShi">
                        <option value="">请选择款式 </option>
                        <option value="1">其他</option>
                      </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label for="styleys" class="layui-form-label">
                        <span class="x-red">*</span>样式
                    </label>
                    <div class="layui-input-inline">
                      <select name="yangShi" id="yangShi">
                        <option value="">请选择样式</option>
                        <option value="1">长袖</option>
                        <option value="2">棉衣</option>
                        <option value="2">长裙</option>
                      </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label for="productcategory" class="layui-form-label">
                        <span class="x-red">*</span>产品类别
                    </label>
                    <div class="layui-input-inline">
                      <select name="jiJie" id="jiJie">
                        <option value="">请选择类别</option>
                        <option value="1">春季会场</option>
                        <option value="2">夏季会场</option>
                        <option value="2">秋季会场</option>
                        <option value="2">冬季会场</option>
                      </select>
                    </div>
                </div>
                 <div class="layui-form-item">
                    <label for="currentprice" class="layui-form-label">
                        <span class="x-red">*</span>产品ID
                    </label>
                    <div class="layui-input-inline">
                        <input type="text" id="chanPinId" name="chanPinId" required="" lay-verify="required"
                        autocomplete="off" class="layui-input">
                    </div>
                    <div class="layui-form-mid layui-word-aux">
                        <span class="x-red">*</span>请输入ID
                    </div>
                </div>
                <div class="layui-form-item">
                    <label for="L_repass" class="layui-form-label">
                    </label>
                    <button onclick="updateShangPin()"  class="layui-btn" lay-filter="save" >
                        保存
                    </button>
                </div>
            </form>
        </div>
        <script src="./lib/layui/layui.js" charset="utf-8">
        </script>
        <script src="./js/x-layui.js" charset="utf-8">
        </script>
        <script>
        var $ = null;
        var form = null;
        var layer = null;
            layui.use(['form','layer'], function(){
                $ = layui.jquery;
               form = layui.form;
              layer = layui.layer;
              
              
	            $(function(){
	             getProductId();
	            });
             });
            
           
            function getProductId(){
            	$.post("../adminProductDetail?reqName=updateShangPinId",{
            		sId:sessionStorage.getItem("proDeatilId")
            	},function(res){
            		$("#fenLeiId").val(res.fenLeiId);
            		$("#name").val(res.name);
            		
            		$("#caiZhi").val(res.caiZhi);
            		$("#shiChangJia").val(res.shiChangJia);
            		$("#xianJia").val(res.xianJia);
            		$("#faHuoDiZhi").val(res.faHuoDiZhi);
            		$("#kuanShi").val(res.kuanShi);
            		$("#yangShi").val(res.yangShi);
            		$("#chanPinId").val(res.chanPinId);
            	},"json");
            }
            function updateShangPin() {
            	var name=$("#name").val();
            	if (name==null || name=="") {
					return false;//停止代码
				}
            	var img=$("#img").val();
            	if (img==null || img=="") {
					return false;//停止代码
				}
            	var caiZhi=$("#caiZhi").val();
            	if (caiZhi==null || caiZhi=="") {
					return false;//停止代码
				}
            	var shiChangJia=$("#shiChangJia").val();
            	if (shiChangJia==null || shiChangJia=="") {
					return false;//停止代码
				}
            	var xianjia=$("#xianjia").val();
            	if (xianjia==null || xianjia=="") {
					return false;//停止代码
				}
            	var faHuoDiZhi=$("#faHuoDiZhi").val();
            	if (faHuoDiZhi==null || faHuoDiZhi=="") {
					return false;//停止代码
				}
            	var kuanShi=$("#kuanShi").val();
            	if (kuanShi==null || kuanShi=="") {
					return false;//停止代码
				}
            	var yangShi=$("#yangShi").val();
            	if (yangShi==null || yangShi=="") {
					return false;//停止代码
				}
            	var chanPinId=$("#chanPinId").val();
            	if (chanPinId==null || chanPinId=="") {
					return false;//停止代码
				}
            	$.post("../adminProductDetail?reqName=updateShangPin",$("#form_product_detail").serialize(),function(res){
            			if(res.success){
            				layer.msg(res.message);
                			var index = parent.layer
            			}else{
            				layer.msg(res.message);
                			var index = parent.layer.getFrameIndex(window.name);
                			parent.layer.close(index);
                			parent.selProducts();
            			}
            	},"json");
			}
        </script>
        
    </body>

</html>